package com.example.rbacmanage.controller.app;

import com.example.rbacmanage.common.Result;
import com.example.rbacmanage.entity.app.MessageBoard;
import com.example.rbacmanage.service.app.MessageBoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Date;


@RestController
@RequestMapping("/app/messageboard")
public class AppMessageBoardController {
    @Autowired
    private MessageBoardService messageBoardService;

    @GetMapping("/list")
    public Result page(MessageBoard messageBoard){
        return Result.success(messageBoardService.getPage(messageBoard));
    }


    @PostMapping("/add")
    public Result add(@RequestBody MessageBoard messageBoard){
        messageBoard.setCreateTime(new Date());
        messageBoardService.save(messageBoard);
        return Result.success();
    }

}
